home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
math
/
nrpas13
/
poldiv.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-04-29
|
560b
|
23 lines
PROCEDURE poldiv(u: glnarray; n: integer; v: glnvarray; nv: integer;
VAR q,r: glnarray);
(* Programs using routine POLDIV must define the types
TYPE
glnarray = ARRAY [1..n] OF real;
glnvarray = ARRAY [1..nv] OF real;
in the main routine. *)
VAR
k,j: integer;
BEGIN
FOR j := 1 TO n DO BEGIN
r[j] := u[j];
q[j] := 0.0
END;
FOR k := n-nv DOWNTO 0 DO BEGIN
q[k+1] := r[nv+k]/v[nv];
FOR j := nv+k-1 DOWNTO k+1 DO BEGIN
r[j] := r[j]-q[k+1]*v[j-k]
END
END;
r[nv] := 0.0
END;